package com.study.basetype.controller;

import com.study.basetype.annotation.SprintHello;
import com.study.basetype.service.ILoveService;
import com.study.basetype.service.LoveFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author flwu
 * @date 2020/3/22 3:54 PM
 * @MOTTO 保持空杯和敬畏
 */
@RestController
public class TestAnnotationController {

    @SprintHello
    @RequestMapping(value = "/hello")
    public void sprintHello() {
        System.out.println("my name is controller sprint hello methods");
    }

    @RequestMapping(value = "/love/{type}")
    public void love(@PathVariable("type") int type) {
        ILoveService loveService = LoveFactory.getLoveService(type);
        loveService.sayLove();
    }

}
